#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<char, int> mp;
    int cnt = 0;
    for(auto x : s) {
        if(mp.count(x)) cnt++;
        else cnt += 2;
        mp[x]++;
    }
    cout << cnt << endl;
}

signed main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}